package com.zsc.shixun.common;

import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * <p>
 *     返回值封装类
 * </p>
 *
 * @author Administrator
 */
@Component
@NoArgsConstructor
public class CommonResult<T> {
    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public Object getData() {
        return data;
    }

    public CommonResult(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    private Integer code;

    public void setCode(Integer code) {
        this.code = code;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setData(T data) {
        this.data = data;
    }

    private String msg;
    private T data;
    public CommonResult(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public CommonResult(ResultCode code) {
        this.code = code.getCode();
        this.msg = code.getMsg();
    }
}
